package com.wpre.blogsystem.common.utils;

import com.wpre.blogsystem.common.pojo.dataobject.BlogInfo;
import com.wpre.blogsystem.common.pojo.dataobject.UserInfo;
import com.wpre.blogsystem.common.pojo.response.BlogInfoResponse;
import com.wpre.blogsystem.common.pojo.response.UserInfoResponse;
import org.springframework.beans.BeanUtils;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-12-05
 * Time: 14:26
 */
public class BeanTransfer {
    public static BlogInfoResponse trans(BlogInfo blogInfo) {
        BlogInfoResponse blogInfoResponse = new BlogInfoResponse();
        if (blogInfo != null) {
            //转换
            BeanUtils.copyProperties(blogInfo, blogInfoResponse);
        }
        return blogInfoResponse;
    }
    public static UserInfoResponse trans(UserInfo userInfo) {
        UserInfoResponse userInfoResponse = new UserInfoResponse();
        if (userInfo != null) {
            //转换
            BeanUtils.copyProperties(userInfo, userInfoResponse);
        }
        return userInfoResponse;
    }
}
